/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef MSDP_ALGORITHM_COMMON_H
#define MSDP_ALGORITHM_COMMON_H

#include <string>
#include <map>
#include "constants.h"

namespace OHOS {
namespace Msdp {
enum MsdpDeviceType : uint32_t {
    TYPE_UNKNOWN = 0x00,
    TYPE_WIFI_CAMERA = 0x08,
    TYPE_AUDIO = 0x0A,
    TYPE_PC = 0x0C,
    TYPE_PHONE = 0x0E,
    TYPE_PAD = 0x11,
    TYPE_WATCH = 0x6D,
    TYPE_CAR = 0x83,
    TYPE_TV = 0x9C,
};

enum SpatialDirection : int32_t {
    INVALID = -1,
    FRONT,
    BACK,
    LEFT,
    RIGHT,
    UP,
    DOWN,
    INSIDE,
};

class SpatialDevice {
public:
    std::string deviceId;
    uint32_t typeId;
    std::string networkId;
    std::string deviceName;
};

class SpatialEvent {
public:
    SpatialDevice device;
    SpatialDirection direction = SpatialDirection::INVALID;
    double distance = INVALID_DATA;
    double angle = INVALID_DATA;
    int innerOuter = INVALID_DATA;
    int exist = INVALID_DATA;
    int32_t mode = 0;
    bool IsExact() const
    {
        if ((distance == INVALID_DATA) && (angle == INVALID_DATA)) {
            return false;
        }
        return true;
    }
};

enum class TransmissionMedium : int32_t {
    /** Bluetooth */
    BLUETOOTH = 0,
    /** Wi-Fi */
    WIFI = 1,
    /** USB */
    USB = 2,
    /** Ethernet */
    ETHERNET = 3,
    /* Ultrasound */
    ULTRASOUND = 4,
    DM_MEDIUM_BUTT
};

enum class AlgorithmType : uint32_t {
    INVALID = 0,
    DIRECTION = 1,
    DISTANCE = 2,
    ANGLE = 3,
    INNEROUTER = 4,
    EXIST = 5,
    COMMON = 6,
};

enum class MediumPriority : uint32_t {
    HIGH = 0,
    MIDDLE,
    LOW,
};

/**
 * @brief Structure of algorithm library capabilities
 *
 */
struct MsdpAlgorithmCapability {
    std::string vecdor;
    std::string version;
    std::string description;
    std::map<TransmissionMedium, MediumPriority> mediumMap_;
    AlgorithmType type;
};
} // namespace Msdp
} // namespace OHOS
#endif // MSDP_ALGORITHM_COMMON_H